﻿<rules>
  <rule id="Entry.Core.1022" category="core" target="entry" specificationsection ="2.2.6.3.3" requirementlevel="must" format="json">
    <description>If name/value pair named "__metadata" is included, the value of the "type" name/value pair MUST be the namespace qualified name, as specified in [MC-CSDL], of the EntityType of the instance that the JSON object represents.</description>
    <action processor="jsonschema">
      <jsonschema>
        {
        "additionalProperties" : false,
        "type" : "object",
        "properties" : {

        "d" : {
        "additionalProperties" : true,
        "type" : "object",
        "properties" : {

        "__metadata" : {
        "additionalProperties" : true,
        "type" : "object",
        "properties" : {
        <!-- Check the type value to see if they match -->
        "type" : { "type" : "string", "enum" : ["$NSENTITYTYPE$"], "required" : true }
        }
        },

        }
        }

        }
        }
      </jsonschema>
    </action>
    <errormessage>If name/value pair named "__metadata" is included, the value of the "type" name/value pair MUST be the namespace qualified name, as specified in [MC-CSDL], of the EntityType of the instance that the JSON object represents.</errormessage>
  </rule>
</rules>